<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang>
<head>
  <meta http-equiv='X-UA-Compatible' content='IE=edge' />
  <meta http-equiv='MSThemeCompatible' content='Yes'>

  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>Menu Procedures</title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
  <style type="text/css">@font-face {font-family: octicons-link;src: url(data:font/woff;charset=utf-8;base64,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) format('woff');}body {-webkit-text-size-adjust: 100%;text-size-adjust: 100%;color: #333;font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size: 16px;line-height: 1.6;word-wrap: break-word;max-width: 99%;box-sizing: border-box;padding: 20px 5px 8rem 5px; margin-left: auto;margin-right: auto;}body a {background-color: transparent;}body a:active,body a:hover {outline: 0;}body strong {font-weight: bold;}body h1 {font-size: 2em;margin: 0.67em 0;}body img {border: 0;}body hr {box-sizing: content-box;height: 0;}body pre {overflow: auto;}body code,body kbd,body pre {font-family: monospace, monospace;font-size: 1em;}body input {color: inherit;font: inherit;margin: 0;}body html input[disabled] {cursor: default;}body input {line-height: normal;}body input[type="checkbox"] {box-sizing: border-box;padding: 0;}body table {border-collapse: collapse;border-spacing: 0;}body td,body th {padding: 0;}body * {box-sizing: border-box;}body input {font: 13px / 1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";}body a {color: #4078c0;text-decoration: none;}body a:hover,body a:active {text-decoration: underline;}body hr {height: 0;margin: 15px 0;overflow: hidden;background: transparent;border: 0;border-bottom: 1px solid #ddd;}body hr:before {display: table;content: "";}body hr:after {display: table;clear: both;content: "";}body h1,body h2,body h3,body h4,body h5,body h6 {margin-top: 15px;margin-bottom: 15px;line-height: 1.1;}body h1 {font-size: 30px;}body h2 {font-size: 21px;}body h3 {font-size: 16px;}body h4 {font-size: 14px;}body h5 {font-size: 12px;}body h6 {font-size: 11px;}body blockquote {margin: 0;}body ul,body ol {padding: 0;margin-top: 0;margin-bottom: 0;}body ol ol,body ul ol {list-style-type: lower-roman;}body ul ul ol,body ul ol ol,body ol ul ol,body ol ol ol {list-style-type: lower-alpha;}body dd {margin-left: 0;}body code {font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;font-size: 12px;}body pre {margin-top: 0;margin-bottom: 0;font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;}body .select::-ms-expand {opacity: 0;}body .octicon {font: normal normal normal 16px/1 octicons-link;display: inline-block;text-decoration: none;text-rendering: auto;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}body .octicon-link:before {content: '\f05c';}body:before {display: table;content: "";}body:after {display: table;clear: both;content: "";}body>*:first-child {margin-top: 0 !important;}body>*:last-child {margin-bottom: 0 !important;}body a:not([href]) {color: inherit;text-decoration: none;}body .anchor {display: inline-block;padding-right: 2px;margin-left: -18px;}body .anchor:focus {outline: none;}body h1,body h2,body h3,body h4,body h5,body h6 {margin-top: 1em;margin-bottom: 16px;font-weight: bold;line-height: 1.4;}body h1 .octicon-link,body h2 .octicon-link,body h3 .octicon-link,body h4 .octicon-link,body h5 .octicon-link,body h6 .octicon-link {color: #000;vertical-align: middle;visibility: hidden;}body h1:hover .anchor,body h2:hover .anchor,body h3:hover .anchor,body h4:hover .anchor,body h5:hover .anchor,body h6:hover .anchor {text-decoration: none;}body h1:hover .anchor .octicon-link,body h2:hover .anchor .octicon-link,body h3:hover .anchor .octicon-link,body h4:hover .anchor .octicon-link,body h5:hover .anchor .octicon-link,body h6:hover .anchor .octicon-link {visibility: visible;}body h1 {padding-bottom: 0.3em;font-size: 1.75em;line-height: 1.2;}body h1 .anchor {line-height: 1;}body h2 {padding-bottom: 0.3em;font-size: 1.5em;line-height: 1.225;}body h2 .anchor {line-height: 1;}body h3 {font-size: 1.25em;line-height: 1.43;}body h3 .anchor {line-height: 1.2;}body h4 {font-size: 1em;}body h4 .anchor {line-height: 1.2;}body h5 {font-size: 1em;}body h5 .anchor {line-height: 1.1;}body h6 {font-size: 1em;color: #777;}body h6 .anchor {line-height: 1.1;}body p,body blockquote,body ul,body ol,body dl,body table,body pre {margin-top: 0;margin-bottom: 16px;}body hr {height: 4px;padding: 0;margin: 16px 0;background-color: #e7e7e7;border: 0 none;}body ul,body ol {padding-left: 2em;}body ul ul,body ul ol,body ol ol,body ol ul {margin-top: 0;margin-bottom: 0;}body li>p {margin-top: 16px;}body dl {padding: 0;}body dl dt {padding: 0;margin-top: 16px;font-size: 1em;font-style: italic;font-weight: bold;}body dl dd {padding: 0 16px;margin-bottom: 16px;}body blockquote {padding: 0 15px;color: #777;border-left: 4px solid #ddd;}body blockquote>:first-child {margin-top: 0;}body blockquote>:last-child {margin-bottom: 0;}body table {display: block;width: 100%;overflow: auto;word-break: normal;word-break: keep-all;}body table th {font-weight: bold;}body table th,body table td {padding: 6px 13px;border: 1px solid #ddd;}body table tr {background-color: #fff;border-top: 1px solid #ccc;}body table tr:nth-child(2n) {background-color: #f8f8f8;}body img {max-width: 100%;box-sizing: content-box;background-color: #fff;}body code {padding: 0;padding-top: 0;padding-bottom: 0;margin: 0;font-size: 85%;background-color: rgba(0,0,0,0.04);border-radius: 3px;}body code:before,body code:after {letter-spacing: -0.2em;content: "\00a0";}body pre>code {padding: 0;margin: 0;font-size: 100%;word-break: normal;white-space: pre;background: transparent;border: 0;}body .highlight {margin-bottom: 16px;}body .highlight pre,body pre {padding: 16px;overflow: auto;font-size: 85%;line-height: 1.45;background-color: #f7f7f7;border-radius: 3px;}body .highlight pre {margin-bottom: 0;word-break: normal;}body pre {word-wrap: normal;}body pre code {display: inline;max-width: initial;padding: 0;margin: 0;overflow: initial;line-height: inherit;word-wrap: normal;background-color: transparent;border: 0;}body pre code:before,body pre code:after {content: normal;}body kbd {display: inline-block;padding: 3px 5px;font-size: 11px;line-height: 10px;color: #555;vertical-align: middle;background-color: #fcfcfc;border: solid 1px #ccc;border-bottom-color: #bbb;border-radius: 3px;box-shadow: inset 0 -1px 0 #bbb;}body .pl-c {color: #969896;}body .pl-c1,body .pl-s .pl-v {color: #0086b3;}body .pl-e,body .pl-en {color: #795da3;}body .pl-s .pl-s1,body .pl-smi {color: #333;}body .pl-ent {color: #63a35c;}body .pl-k {color: #a71d5d;}body .pl-pds,body .pl-s,body .pl-s .pl-pse .pl-s1,body .pl-sr,body .pl-sr .pl-cce,body .pl-sr .pl-sra,body .pl-sr .pl-sre {color: #183691;}body .pl-v {color: #ed6a43;}body .pl-id {color: #b52a1d;}body .pl-ii {background-color: #b52a1d;color: #f8f8f8;}body .pl-sr .pl-cce {color: #63a35c;font-weight: bold;}body .pl-ml {color: #693a17;}body .pl-mh,body .pl-mh .pl-en,body .pl-ms {color: #1d3e81;font-weight: bold;}body .pl-mq {color: #008080;}body .pl-mi {color: #333;font-style: italic;}body .pl-mb {color: #333;font-weight: bold;}body .pl-md {background-color: #ffecec;color: #bd2c00;}body .pl-mi1 {background-color: #eaffea;color: #55a532;}body .pl-mdr {color: #795da3;font-weight: bold;}body .pl-mo {color: #1d3e81;}body kbd {display: inline-block;padding: 3px 5px;font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;line-height: 10px;color: #555;vertical-align: middle;background-color: #fcfcfc;border: solid 1px #ccc;border-bottom-color: #bbb;border-radius: 3px;box-shadow: inset 0 -1px 0 #bbb;}body .task-list-item {list-style-type: none;}body .task-list-item+.task-list-item {margin-top: 3px;}body .task-list-item input {margin: 0 0.35em 0.25em -1.6em;vertical-align: middle;}body :checked+.radio-label {z-index: 1;position: relative;border-color: #4078c0;}</style>
  
    
  
</head>
<body>
<h1 id="menu-procedures">Menu Procedures</h1>
<table>
<thead>
<tr class="header">
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><a href="#AfxAddIconToMenuItem">AfxAddIconToMenuItem</a></td>
<td>Converts an icon handle to a bitmap and adds it to the specified <em>hbmpItem</em> field of HMENU item.</td>
</tr>
<tr class="even">
<td><a href="#AfxCheckMenuItem">AfxCheckMenuItem</a></td>
<td>Checks a menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxDisableMenuItem">AfxDisableMenuItem</a></td>
<td>Disables the specified menu item.</td>
</tr>
<tr class="even">
<td><a href="#AfxEnableMenuItem">AfxEnableMenuItem</a></td>
<td>Enables the specified menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxGetMenuFont">AfxGetMenuFont</a></td>
<td>Retrieves information about the font used in menu bars.</td>
</tr>
<tr class="even">
<td><a href="#AfxGetMenuFontPointSize">AfxGetMenuFontPointSize</a></td>
<td>Retrieves the point size of the font used in menu bars.</td>
</tr>
<tr class="odd">
<td><a href="#AfxGetMenuItemState">AfxGetMenuItemState</a></td>
<td>Retrieves the state of the specified menu item.</td>
</tr>
<tr class="even">
<td><a href="#AfxGetMenuItemText">AfxGetMenuItemText</a></td>
<td>Retrieves the text of the specified menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxGetMenuItemTextLen">AfxGetMenuItemTextLen</a></td>
<td>Retrieves lenth of the of the specified menu item.</td>
</tr>
<tr class="even">
<td><a href="#AfxGetMenuRect">AfxGetMenuRect</a></td>
<td>Calculates the size of a menu bar or a drop-down menu.</td>
</tr>
<tr class="odd">
<td><a href="#AfxGrayMenuItem">AfxGrayMenuItem</a></td>
<td>Grays the specified menu item.</td>
</tr>
<tr class="even">
<td><a href="#AfxHiliteMenuItem">AfxHiliteMenuItem</a></td>
<td>Highlights the specified menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxIsMenuItemChecked">AfxIsMenuItemChecked</a></td>
<td>Returns TRUE if the specified menu item is checked; FALSE otherwise.</td>
</tr>
<tr class="even">
<td><a href="#AfxIsMenuItemDisabled">AfxIsMenuItemDisabled</a></td>
<td>Returns TRUE if the specified menu item is disabled; FALSE otherwise.</td>
</tr>
<tr class="odd">
<td><a href="#AfxIsMenuItemEnabled">AfxIsMenuItemEnabled</a></td>
<td>Returns TRUE if the specified menu item is enabled; FALSE otherwise.</td>
</tr>
<tr class="even">
<td><a href="#AfxIsMenuItemGrayed">AfxIsMenuItemGrayed</a></td>
<td>Returns TRUE if the specified menu item is grayed; FALSE otherwise.</td>
</tr>
<tr class="odd">
<td><a href="#AfxIsMenuItemHighlighted">AfxIsMenuItemHighlighted</a></td>
<td>Returns TRUE if the specified menu item is highlighted; FALSE otherwise.</td>
</tr>
<tr class="even">
<td><a href="#AfxIsMenuItemOwnerDraw">AfxIsMenuItemOwnerDraw</a></td>
<td>Returns TRUE if the specified menu item is a ownerdraw; FALSE otherwise.</td>
</tr>
<tr class="odd">
<td><a href="#AfxIsMenuItemPopup">AfxIsMenuItemPopup</a></td>
<td>Returns TRUE if the specified menu item is a submenu; FALSE otherwise.</td>
</tr>
<tr class="even">
<td><a href="#AfxIsMenuItemSeparator">AfxIsMenuItemSeparator</a></td>
<td>Returns TRUE if the specified menu item is a separator; FALSE otherwise.</td>
</tr>
<tr class="odd">
<td><a href="#AfxRemoveCloseMenu">AfxRemoveCloseMenu</a></td>
<td>Removes the system menu close option and disables the X button.</td>
</tr>
<tr class="even">
<td><a href="#AfxRightJustifyMenuItem">AfxRightJustifyMenuItem</a></td>
<td>Right justifies a top level menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxSetMenuItemBold">AfxSetMenuItemBold</a></td>
<td>Changes the text of a menu item to bold.</td>
</tr>
<tr class="even">
<td><a href="#AfxSetMenuItemState">AfxSetMenuItemState</a></td>
<td>Sets the state of the specified menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxSetMenuItemText">AfxSetMenuItemText</a></td>
<td>Sets the text of the specified menu item.</td>
</tr>
<tr class="even">
<td><a href="#AfxToggleMenuItem">AfxToggleMenuItem</a></td>
<td>Toggles the checked state of a menu item.</td>
</tr>
<tr class="odd">
<td><a href="#AfxUnCheckMenuItem">AfxUnCheckMenuItem</a></td>
<td>Unchecks a menu item.</td>
</tr>
</tbody>
</table>
<h1 id="afxaddicontomenuitem"><a name="AfxAddIconToMenuItem"></a>AfxAddIconToMenuItem</h1>
<p>Converts an icon handle to a bitmap and adds it to the specified <em>hbmpItem field</em> of <strong>HMENU</strong> item.</p>
<pre><code>FUNCTION AfxAddIconToMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS BOOLEAN, BYVAL hIcon AS HICON, BYVAL fAutoDestroy AS BOOLEAN = TRUE, _
   BYVAL phbmp AS HBITMAP PTR = NULL) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
<tr class="even">
<td><em>hIcon</em></td>
<td>Handle of the icon to add to the menu.</td>
</tr>
<tr class="odd">
<td><em>fAutoDestroy</em></td>
<td>TRUE (the default) or FALSE. If TRUE, <strong>AfxAddIconToMenuItem</strong> destroys the icon before returning.</td>
</tr>
<tr class="even">
<td><em>phbmp</em></td>
<td>Out. Location where the bitmap representation of the icon is stored. Can be NULL.</td>
</tr>
</tbody>
</table>
<h4 id="return-value">Return value</h4>
<p>TRUE or FALSE.</p>
<h4 id="remarks">Remarks</h4>
<p>The caller is responsible for destroying the bitmap generated. The icon will be destroyed if <em>fAutoDestroy</em> is set to true. The <em>hbmpItem</em> field of the menu item can be used to keep track of the bitmap by passing NULL to <em>phbmp</em>.</p>
<p>Using <strong>AfxGdipAddIconFromFile</strong> or <strong>AfxGdipIconFromRes</strong> to load the image from a file or resource and convert it to a icon you can use alphablended .png icons.</p>
<h4 id="usage-example">Usage example</h4>
<p>Loading the icon from disc:</p>
<pre><code>DIM hSubMenu AS HMENU = GetSubMenu(hMenu, 1)
DIM hIcon AS HICON = LoadImageW(NULL, ExePath &amp; &quot;\undo_32.ico&quot;, IMAGE_ICON, 32, 32, LR_LOADFROMFILE)
IF hIcon THEN AfxAddIconToMenuItem(hSubMenu, 0, TRUE, hIcon)
</code></pre>
<p>Loading the icon from a resource file:</p>
<pre><code>DIM hSubMenu AS HMENU = GetSubMenu(hMenu, 1)
AfxAddIconToMenuItem(hSubMenu, 0, TRUE, AfxGdipIconFromRes(hInstance, &quot;IDI_UNDO_32&quot;))
</code></pre>
<h1 id="afxcheckmenuitem"><a name="AfxCheckMenuItem"></a>AfxCheckMenuItem</h1>
<p>Checks a menu item.</p>
<pre><code>FUNCTION AfxCheckMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS LONG
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-1">Return value</h4>
<p>The return value specifies the previous state of the menu item (either MF_CHECKED or MF_UNCHECKED). If the menu item does not exist, the return value is -1.</p>
<h1 id="afxdisablemenuitem"><a name="AfxDisableMenuItem"></a>AfxDisableMenuItem</h1>
<p>Disables the specified menu item.</p>
<pre><code>FUNCTION AfxDisableMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS DWORD
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-2">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h4 id="remarks-1">Remarks</h4>
<p>The application must call the <strong>DrawMenuBar</strong> function whenever a menu changes, whether or not the menu is in a displayed window.</p>
<h1 id="afxenablemenuitem"><a name="AfxEnableMenuItem"></a>AfxEnableMenuItem</h1>
<p>Enables the specified menu item.</p>
<pre><code>FUNCTION AfxEnableMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-3">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h4 id="remarks-2">Remarks</h4>
<p>The application must call the <strong>DrawMenuBar</strong> function whenever a menu changes, whether or not the menu is in a displayed window.</p>
<h1 id="afxgetmenufont"><a name="AfxGetMenuFont"></a>AfxGetMenuFont</h1>
<p>Retrieves information about the font used in menu bars.</p>
<pre><code>FUNCTION AfxGetMenuFont (BYVAL plfw AS LOGFONTW PTR) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>plfw</em></td>
<td>Pointer to a LOGFONTW structure.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-4">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h1 id="afxgetmenufontpointsize"><a name="AfxGetMenuFontPointSize"></a>AfxGetMenuFontPointSize</h1>
<p>Retrieves the point size of the font used in menu bars.</p>
<pre><code>FUNCTION AfxGetMenuFontPointSize () AS LONG
</code></pre>
<h4 id="return-value-5">Return value</h4>
<p>The point size of the font. If the function fails, the return value is 0.</p>
<h1 id="afxgetmenuitemstate"><a name="AfxGetMenuItemState"></a>AfxGetMenuItemState</h1>
<p>Retrieves the state of the specified menu item.</p>
<pre><code>FUNCTION AfxGetMenuItemState (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS DWORD
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-6">Return value</h4>
<p>0 on failure or one or more of the following values:</p>
<pre><code>MFS_CHECKED   The item is checked
MFS_DEFAULT   The menu item is the default.
MFS_DISABLED  The item is disabled.
MFS_ENABLED   The item is enabled.
MFS_GRAYED    The item is grayed.
MFS_HILITE    The item is highlighted
MFS_UNCHECKED The item is unchecked.
MFS_UNHILITE  The item is not highlighed.
</code></pre>
<h1 id="afxgetmenuitemtext"><a name="AfxGetMenuItemText"></a>AfxGetMenuItemText</h1>
<p>Retrieves the text of the specified menu item.</p>
<pre><code>FUNCTION AfxGetMenuItemText (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG) AS CWSTR
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="usage-example-1">Usage example</h4>
<pre><code>DIM cwsText AS CWSTR = AfxGetMenuItemText(hMenu, 1, TRUE)
</code></pre>
<h1 id="afxgetmenuitemtextlen"><a name="AfxGetMenuItemTextLen"></a>AfxGetMenuItemTextLen</h1>
<p>Returns the lengnth of the specified menu item.</p>
<pre><code>FUNCTION AfxGetMenuItemTextLen (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG) AS LONG
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxgetmenurect"><a name="AfxGetMenuRect"></a>AfxGetMenuRect</h1>
<p>Returns the dimensions of a menu bar or a drop-down menu.</p>
<pre><code>FUNCTION AfxGetMenuRect (BYVAL hwnd AS HWND, BYVAL hmenu AS HMENU) AS RECT
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hwnd</em></td>
<td>Handle of the window that owns the menu.</td>
</tr>
<tr class="even">
<td><em>hMenu</em></td>
<td>Handle to the menu.</td>
</tr>
</tbody>
</table>
<h1 id="afxgraymenuitem"><a name="AfxGrayMenuItem"></a>AfxGrayMenuItem</h1>
<p>Grays the specified menu item.</p>
<pre><code>FUNCTION AfxGrayMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-7">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h4 id="remarks-3">Remarks</h4>
<p>The application must call the <strong>DrawMenuBar</strong> function whenever a menu changes, whether or not the menu is in a displayed window.</p>
<h1 id="afxhilitemenuitem"><a name="AfxHiliteMenuItem"></a>AfxHiliteMenuItem</h1>
<p>Highlights the specified menu item.</p>
<pre><code>FUNCTION AfxHiliteMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-8">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h4 id="remarks-4">Remarks</h4>
<p>The application must call the <strong>DrawMenuBar</strong> function whenever a menu changes, whether or not the menu is in a displayed window.</p>
<h1 id="afxismenuitemchecked"><a name="AfxIsMenuItemChecked"></a>AfxIsMenuItemChecked</h1>
<p>Returns TRUE if the specified menu item is checked; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemChecked (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitemdisabled"><a name="AfxIsMenuItemDisabled"></a>AfxIsMenuItemDisabled</h1>
<p>Returns TRUE if the specified menu item is disabled; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemDisabled (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitemenabled"><a name="AfxIsMenuItemEnabled"></a>AfxIsMenuItemEnabled</h1>
<p>Returns TRUE if the specified menu item is enabled; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemEnabled (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitemgrayed"><a name="AfxIsMenuItemGrayed"></a>AfxIsMenuItemGrayed</h1>
<p>Returns TRUE if the specified menu item is grayed; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemGrayed (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitemhighlighted"><a name="AfxIsMenuItemHighlighted"></a>AfxIsMenuItemHighlighted</h1>
<p>Returns TRUE if the specified menu item is highlighted; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemHighlighted (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitemownerdraw"><a name="AfxIsMenuItemOwnerDraw"></a>AfxIsMenuItemOwnerDraw</h1>
<p>Returns TRUE if the specified menu item is a ownerdraw; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemOwnerDraw (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitempopup"><a name="AfxIsMenuItemPopup"></a>AfxIsMenuItemPopup</h1>
<p>Returns TRUE if the specified menu item is a submenu; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemPopup (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxismenuitemseparator"><a name="AfxIsMenuItemSeparator"></a>AfxIsMenuItemSeparator</h1>
<p>Returns TRUE if the specified menu item is a separator; FALSE otherwise.</p>
<pre><code>FUNCTION AfxIsMenuItemSeparator (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h1 id="afxremoveclosemenu"><a name="AfxRemoveCloseMenu"></a>AfxRemoveCloseMenu</h1>
<p>Removes the system menu close option and disables the X button.</p>
<pre><code>SUB AfxRemoveCloseMenu (BYVAL hwnd AS HWND) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hwnd</em></td>
<td>Handle to the window that owns the menu.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-9">Return value</h4>
<p>TRUE or FALSE.</p>
<h1 id="afxrightjustifymenuitem"><a name="AfxRightJustifyMenuItem"></a>AfxRightJustifyMenuItem</h1>
<p>Right justifies a top level menu item.</p>
<pre><code>FUNCTION AfxRightJustifyMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hwnd</em></td>
<td>Handle to the window that owns the menu.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The zero-based position of the top level menu item to justify.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-10">Return value</h4>
<p>If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.</p>
<h4 id="remarks-5">Remarks</h4>
<p>This is usually used to have the Help menu item right-justified on the menu bar.</p>
<h1 id="afxsetmenuitembold"><a name="AfxSetMenuItemBold"></a>AfxSetMenuItemBold</h1>
<p>Changes the text of a menu item to bold.</p>
<pre><code>FUNCTION AfxSetMenuItemBold (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hwnd</em></td>
<td>Handle to the window that owns the menu.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The zero-based position of the top level menu item to bold.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-11">Return value</h4>
<p>If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.</p>
<h1 id="afxsetmenuitemstate"><a name="AfxSetMenuItemState"></a>AfxSetMenuItemState</h1>
<p>Sets the state of the specified menu item.</p>
<pre><code>FUNCTION AfxSetMenuItemState (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fState AS DWORD, BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fState</em></td>
<td>The menu item state. It can be one or more of these values:<br>MFS_CHECKED: Checks the menu item.<br>MFS_DEFAULT: Specifies that the menu item is the default.<br>MFS_DISABLED: Disables the menu item and grays it so that it cannot be selected.<br>MFS_ENABLED: Enables the menu item so that it can be selected. This is the default state.<br>MFS_GRAYED: Disables the menu item and grays it so that it cannot be selected.<br>MFS_HILITE: Highlights the menu item.<br>MFS_UNCHECKED: Unchecks the menu item.<br>MFS_UNHILITE: Removes the highlight from the menu item. This is the default state.</td>
</tr>
<tr class="even">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-12">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h4 id="remarks-6">Remarks</h4>
<p>The application must call the <strong>DrawMenuBar</strong> function whenever a menu changes, whether or not the menu is in a displayed window.</p>
<h1 id="afxsetmenuitemtext"><a name="AfxSetMenuItemText"></a>AfxSetMenuItemText</h1>
<p>Sets the text of the specified menu item.</p>
<pre><code>FUNCTION AfxSetMenuItemText (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYREF wszText AS WSTRING, BYVAL fByPosition AS LONG = FALSE) AS BOOLEAN
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>wszText</em></td>
<td>The text to set.</td>
</tr>
<tr class="even">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-13">Return value</h4>
<p>TRUE or FALSE. To get extended error information, use the <strong>GetLastError</strong> function.</p>
<h4 id="remarks-7">Remarks</h4>
<p>The application must call the <strong>DrawMenuBar</strong> function whenever a menu changes, whether or not the menu is in a displayed window.</p>
<h1 id="afxtogglemenuitem"><a name="AfxToggleMenuItem"></a>AfxToggleMenuItem</h1>
<p>Toggles the checked state of a menu item.</p>
<pre><code>FUNCTION AfxToggleMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS LONG
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-14">Return value</h4>
<p>The return value specifies the previous state of the menu item (either MF_CHECKED or MF_UNCHECKED). If the menu item does not exist, the return value is -1.</p>
<h1 id="afxuncheckmenuitem"><a name="AfxUnCheckMenuItem"></a>AfxUnCheckMenuItem</h1>
<p>Unchecks a menu item.</p>
<pre><code>FUNCTION AfxUnCheckMenuItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, _
   BYVAL fByPosition AS LONG = FALSE) AS LONG
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>hMenu</em></td>
<td>Handle to the menu that contains the menu item.</td>
</tr>
<tr class="even">
<td><em>uItem</em></td>
<td>The identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of <em>fByPosition</em>.</td>
</tr>
<tr class="odd">
<td><em>fByPosition</em></td>
<td>The meaning of <em>uItem</em>. If this parameter is FALSE, <em>uItem</em> is a menu item identifier. Otherwise, it is a menu item position.</td>
</tr>
</tbody>
</table>
<h4 id="return-value-15">Return value</h4>
<p>The return value specifies the previous state of the menu item (either MF_CHECKED or MF_UNCHECKED). If the menu item does not exist, the return value is -1.</p>
</body>
</html>

